﻿/*=================================================================
* 版权信息：Copyright (C) 2005-2011 捷点科技 All Rights Reserved.
* 文件名称：CNVP_ProductsDetail.cs
* 创建标识：曾乃强 15158756652 2011-03-18 01:03:05
* 修改标识：
* 功能描述：
===================================================================*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using CNVP.Framework.Helper;


namespace CNVP.JShop.BLL 
{
    /// <summary>
    /// 对*CNVP_ProductsDetail*操作(针对业务层)的实现
    /// </summary>
    public class CNVP_ProductsDetail
    {
        DAL.CNVP_ProductsDetail dal = new DAL.CNVP_ProductsDetail();
        
        #region BLL
        #region 添加
        /// <summary>
        /// 添加
        /// </summary>
        public int Add_CNVP_ProductsDetail(Model.CNVP_ProductsDetail obj)
        {
            return dal.Insert(obj);
        }
        #endregion
        
        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        public int Update_CNVP_ProductsDetail(Model.CNVP_ProductsDetail obj)
        {
            return dal.Update(obj);
        }
        #endregion
        
        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        public int Delete_CNVP_ProductsDetail(Model.CNVP_ProductsDetail obj)
        {
            return dal.Delete(obj);
        }
        
        /// <summary>
        /// 删除,生成列的主键列构成的参数列表
        /// </summary>
        public int Delete_CNVP_ProductsDetail(int ID)
        {
            return this.Delete_CNVP_ProductsDetail(new Model.CNVP_ProductsDetail() {
            
                 ID=ID
            });
        }
        #endregion 
        
        /// <summary>
        /// 查看单个
        /// </summary>
        public Model.CNVP_ProductsDetail GetSingle_CNVP_ProductsDetailById(int ID)
        {
            return dal.LoadById(ID);
        }
        public Model.CNVP_ProductsDetail GetSingle_CNVP_ProductsDetailByPIDAndSID(int pID,string sID)
        {
            return dal.GetSingle_CNVP_ProductsDetailByPIDAndSID(pID,sID);
        }
        /// <summary>
        /// 查看全部
        /// </summary>
        public List<Model.CNVP_ProductsDetail> GetAll_CNVP_ProductsDetail()
        {
            return dal.LoadAll();
        }
        #endregion

        /// <summary>
        /// 查看全部
        /// </summary>
        public List<Model.CNVP_ProductsDetail> GetAll_CNVP_ProductsDetail(int ProductID)
        {
            return dal.LoadAllByProductID(ProductID);
        }

        /// <summary>
        /// 删除,不存在的ID (not in)
        /// </summary>
        public int Delete_CNVP_ProductsDetailNotIn(int ProductID, string nowid)
        {
            return dal.DeleteNotIn(ProductID, nowid);
        }

        /// <summary>
        /// 配送更新库存 -库存
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int UpdateNum(int ProductsDetailID, int OrderNum,int type)
        {
            return dal.UpdateNum(ProductsDetailID, OrderNum,type);
        }
    }
}

